const path = require('path');

console.log(path.basename('a/b/c/d.html'));
// => d.html
console.log(path.basename('a/b/c/d.html', 'html'));
// => d.
console.log(path.basename('a/b/c/d.html', '.html'));
// => d

console.log(path.basename('/a/b/c/d/'));
// => d
